const path = require('path')
// import fs
const fs = require('fs')
import config from './config'
const BASE_API = config.BASE_API
const BASE_API_PATH = path.resolve(BASE_API)
let remoteApi = fs.readdirSync(BASE_API_PATH)
console.info(config.COLOR.yellow, '\t-------------------')
console.info(config.COLOR.yellow, '\t-------------------')
console.info(config.COLOR.yellow, '\t-------------------')
console.info(config.COLOR.yellow, '\t-------------------')
console.info(config.COLOR.yellow, '\t-------------------')
console.info(config.COLOR.yellow, '\tloading remote mock data......')
console.info(config.COLOR.yellow, '\t')
const remoteEngine = []
remoteApi.forEach(element => {
	const f = require(BASE_API_PATH + '\\' + element)
	if (typeof f === 'function') {
		const v = f()
		remoteEngine.push(v)
	}
})
let data = {}
remoteEngine.forEach(element => {
	const key = Object.keys(element)[0]
	data[key] = element[key]
});
export default data
